<?php
	$breadcrumbs = (isset($breadcrumbs)) ? $breadcrumbs : NULL;
	$class = $this->router->class;
	$method = $this->router->method;
	$active = "{$class}/{$method}";
?><!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	
	<title><?php echo $site_name ?><?php if ($breadcrumbs): ?> / <?php foreach($breadcrumbs as $k => $b): ?><?php echo $b['name']; ?><?php if (array_key_exists($k+1, $breadcrumbs)): ?> / <?php endif; ?><?php endforeach; ?><?php endif; ?></title>
	
	<link rel="stylesheet" href="<?php echo base_url('assets/css/styl.css'); ?>" />
	<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
	<script type="text/javascript" src="<?php echo base_url('assets/js/bootstrap.min.js'); ?>"></script>
	<script type="text/javascript">
	$(document).ready(function(){
		$(".login-btn").click(function(e){ e.preventDefault(); $("#modal-login").modal(); });
	});
	</script>
</head>

<body>
<div class="container" id="main">
	<!-- NAVBAR -->
	<div class="navbar">
		<div class="navbar-inner">
			<div class="container">
				<a data-target=".nav-collapse" data-toggle="collapse" class="btn btn-navbar">
				<span class="icon-bar"></span>
				<span class="icon-bar"></span>
				<span class="icon-bar"></span>
				</a>
				<a href="<?php if ( ! $this->auth->is_logged_in()): echo site_url(); else: echo site_url('user'); endif; ?>" class="brand">SJAP Bank</a>
				<div class="nav-collapse">
					<ul class="nav">
						<li<?php if ($active == 'main/index'): ?> class="active"<?php endif; ?>><a href="<?php echo site_url(); ?>"><i class="icon-home"></i> Strona Główna</a></li>
						<?php if ($this->auth->is_logged_in()): ?>
						<li class="dropdown<?php if ($class == 'transfer'): ?> active<?php endif; ?>">
							<a data-toggle="dropdown" class="dropdown-toggle" href="#">Przelewy <b class="caret"></b></a>
							<ul class="dropdown-menu">
								<li<?php if ($active == 'transfer/index'): ?> class="active"<?php endif; ?>><a href="<?php echo site_url('transfer'); ?>">Lista</a></li>
								<li<?php if ($active == 'transfer/create'): ?> class="active"<?php endif; ?>><a href="<?php echo site_url('transfer/create'); ?>">Utwórz Przelew</a></li>
							</ul>
						</li>
						<li class="dropdown<?php if ($class == 'receiver'): ?> active<?php endif; ?>">
							<a data-toggle="dropdown" class="dropdown-toggle" href="#">Odbiorcy <b class="caret"></b></a>
							<ul class="dropdown-menu">
								<li<?php if ($active == 'receiver/index'): ?> class="active"<?php endif; ?>><a href="<?php echo site_url('receiver'); ?>">Lista</a></li>
								<li<?php if ($active == 'receiver/create'): ?> class="active"<?php endif; ?>><a href="<?php echo site_url('receiver/create'); ?>">Zdefiniuj Odbiorcę</a></li>
							</ul>
						</li>
						<li class="dropdown<?php if ($class == 'credit'): ?> active<?php endif; ?>">
							<a data-toggle="dropdown" class="dropdown-toggle" href="#">Kredyty <b class="caret"></b></a>
							<ul class="dropdown-menu">
								<li<?php if ($active == 'credit/index'): ?> class="active"<?php endif; ?>><a href="<?php echo site_url('credit'); ?>">Lista</a></li>
								<li<?php if ($active == 'credit/create'): ?> class="active"<?php endif; ?>><a href="<?php echo site_url('credit/create'); ?>">Weź Kredyt</a></li>
							</ul>
						</li>
						<li class="dropdown<?php if ($class == 'deposit'): ?> active<?php endif; ?>">
							<a data-toggle="dropdown" class="dropdown-toggle" href="#">Lokaty <b class="caret"></b></a>
							<ul class="dropdown-menu">
								<li<?php if ($active == 'deposit/index'): ?> class="active"<?php endif; ?>><a href="<?php echo site_url('deposit'); ?>">Lista</a></li>
								<li<?php if ($active == 'deposit/create'): ?> class="active"<?php endif; ?>><a href="<?php echo site_url('deposit/create'); ?>">Załóż Lokatę</a></li>
							</ul>
						</li>
						<?php endif; ?>
					</ul>
					<ul class="nav pull-right">
					<?php if ( ! $this->auth->is_logged_in()): ?>
						<li><a class="login-btn" href="#"><i class="icon-user"></i> Zaloguj</a></li>
						<li class="divider-vertical"></li>
						<li><a href="<?php echo site_url('register'); ?>"><i class="icon-briefcase"></i> Zarejestruj</a></li>
					<?php elseif ($this->auth->is_logged_in()): ?>
						<li>
							<div class="btn-group">
								<button class="btn"><i class="icon-user"></i> <a href="<?php echo site_url('user'); ?>"><?php echo $this->auth->data('name'); ?></a></button>
								<button class="btn dropdown-toggle" data-toggle="dropdown">
									<span class="caret"></span>
								</button>
								<ul class="dropdown-menu">
									<li><a href="<?php echo site_url('change_password'); ?>">Zmień Hasło</a></li>
									<li><a href="<?php echo site_url('logout'); ?>">Wyloguj</a></li>
								</ul>
							</div>
						</li>
					<?php endif; ?>
					</ul>
				</div>
				<!-- /.nav-collapse -->
			</div>
		</div>
		<!-- /navbar-inner -->
	</div>
	<!-- /NAVBAR -->

	<!-- MAIN SECTION -->
	<section id="global">
	<?php echo $this->template->message(); ?>
    <ul class="breadcrumb">
    	<li><a href="<?php echo site_url(); ?>">Strona Główna</a><?php if ($active != 'main/index'): ?> <span class="divider">/</span><?php endif; ?></li>
   	 	<?php if ($breadcrumbs): ?>
   	 		<?php foreach($breadcrumbs as $k => $b): ?>
   	 			<li><a <?php if ($b['url']): ?>href="<?php echo $b['url']; ?>"<?php endif; ?>><?php echo $b['name']; ?></a><?php if (array_key_exists($k+1, $breadcrumbs)): ?> <span class="divider">/</span><?php endif; ?></li>
   	 		<?php endforeach; ?>
   	 	<?php endif; ?>
    </ul>
    <?php echo $this->template->yield(); ?>
    </section>
	<!-- /MAIN SECTION -->

	<!-- FOOTER -->
	<footer class="footer">
		<p class="pull-right">
			<a href="#">Wróć na górę</a>
		</p>
		<p>Page rendered in {elapsed_time} seconds using {memory_usage}</p>
		<p>© SJAP Bank 2012</p>
	</footer>
	<!-- /FOOTER -->
	
</div>
	
<!-- MODAL LOGIN -->
<div id="modal-login" class="modal fade hide">
	<div class="modal-header">
		<button data-dismiss="modal" class="close" type="button">×</button>
		<h3>Zaloguj</h3>
	</div>
	<form accept-charset="utf-8" method="post" style="margin: 0;" class="form-horizontal" action="<?php echo site_url('login'); ?>">
		<div class="modal-body">
			<div class="control-group">
				<label for="login_username" class="control-label">Nazwa Użytkownika </label>
				<div class="controls">
					<input type="text" value="" placeholder="Podaj nazwę użytkownika" class="input-xlarge" name="login_username">
				</div>
			</div>
			<div class="control-group">
				<label for="login_password" class="control-label">Hasło</label>
				<div class="controls">
					<input type="password" value="" placeholder="Podaj hasło" class="input-xlarge" name="login_password">
				</div>
			</div>
		</div>
		<div class="modal-footer">
			<a href="<?php echo site_url('register'); ?>" class="btn"><i class="icon-briefcase"></i> Zarejestruj</a>
			<button type="submit" class="btn btn-primary" name="login_submit" value="submit"><i class="icon-white icon-user"></i> Zaloguj</button>
		</div>
	</form>
</div>
<!-- /MODAL LOGIN -->

</body>
</html>
